package com.submit.demo.common.api;

import lombok.Data;

import java.util.List;


/**
 * 分页数据封装类
 * Created by macro on 2019/4/19.
 */
@Data
public class CommonPage<T> {
    private Integer pageNum;
    private Integer pageSize;
    private Long totalPage;
    private Long total;
    private List<T> list;

    public CommonPage(Integer pageNum, Long total, Integer pageSize, List<T> list) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.total = total;
        this.list = list;
        this.totalPage = total / pageSize + (total % pageSize == 0 ? 0 : 1);
    }

    public CommonPage(Integer pageNum, Integer pageSize, List<T> list) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.list = list;
    }
}
